﻿namespace HRM.CORE
{

    using APP.HELPER.Data.Helper;
    using Extra.ERP;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;

    public class HRM_PROCESS_CONFIRMTIMEKEEPER
    {
        private Guid m_ConfirmTimeKeeperID;
        private DateTime m_Date;
        private string m_Description;
        private string m_EmployeeCode;
        private string m_Reason;
        private string m_ReasonCannot;
        private string m_ShiftCode;
        private int m_Status;
        private DateTime m_TimeIn;
        private DateTime m_TimeOut;
        private DateTime m_WriteDate;

        public HRM_PROCESS_CONFIRMTIMEKEEPER()
        {
            this.m_ConfirmTimeKeeperID = Guid.Empty;
            this.m_EmployeeCode = "";
            this.m_WriteDate = DateTime.Now;
            this.m_Date = DateTime.Now;
            this.m_TimeIn = DateTime.Now;
            this.m_TimeOut = DateTime.Now;
            this.m_ShiftCode = "";
            this.m_Reason = "";
            this.m_Status = 0;
            this.m_ReasonCannot = "";
            this.m_Description = "";
        }

        public HRM_PROCESS_CONFIRMTIMEKEEPER(Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            this.m_ConfirmTimeKeeperID = ConfirmTimeKeeperID;
            this.m_EmployeeCode = EmployeeCode;
            this.m_WriteDate = WriteDate;
            this.m_Date = Date;
            this.m_TimeIn = TimeIn;
            this.m_TimeOut = TimeOut;
            this.m_ShiftCode = ShiftCode;
            this.m_Reason = Reason;
            this.m_Status = Status;
            this.m_ReasonCannot = ReasonCannot;
            this.m_Description = Description;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { this.m_ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_CONFIRMTIMEKEEPER_Delete", myParams, myValues);
        }

        public string Delete(Guid ConfirmTimeKeeperID)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_CONFIRMTIMEKEEPER_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, Guid ConfirmTimeKeeperID)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_PROCESS_CONFIRMTIMEKEEPER_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, Guid ConfirmTimeKeeperID)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_PROCESS_CONFIRMTIMEKEEPER_Delete", myParams, myValues);
        }

        public bool Exist(Guid ConfirmTimeKeeperID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("DIC_RECRUITMENT_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(Guid ConfirmTimeKeeperID)
        {
            string str = "";
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_PROCESS_CONFIRMTIMEKEEPER_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_ConfirmTimeKeeperID = reader.GetGuid(reader.GetOrdinal("ConfirmTimeKeeperID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_WriteDate = Convert.ToDateTime(reader["WriteDate"]);
                    this.m_Date = Convert.ToDateTime(reader["Date"]);
                    this.m_TimeIn = Convert.ToDateTime(reader["TimeIn"]);
                    this.m_TimeOut = Convert.ToDateTime(reader["TimeOut"]);
                    this.m_ShiftCode = Convert.ToString(reader["ShiftCode"]);
                    this.m_Reason = Convert.ToString(reader["Reason"]);
                    this.m_Status = Convert.ToInt32(reader["Status"]);
                    this.m_ReasonCannot = Convert.ToString(reader["ReasonCannot"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlConnection myConnection, string ConfirmTimeKeeperID)
        {
            string str = "";
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "HRM_PROCESS_CONFIRMTIMEKEEPER_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_ConfirmTimeKeeperID = reader.GetGuid(reader.GetOrdinal("ConfirmTimeKeeperID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_WriteDate = Convert.ToDateTime(reader["WriteDate"]);
                    this.m_Date = Convert.ToDateTime(reader["Date"]);
                    this.m_TimeIn = Convert.ToDateTime(reader["TimeIn"]);
                    this.m_TimeOut = Convert.ToDateTime(reader["TimeOut"]);
                    this.m_ShiftCode = Convert.ToString(reader["ShiftCode"]);
                    this.m_Reason = Convert.ToString(reader["Reason"]);
                    this.m_Status = Convert.ToInt32(reader["Status"]);
                    this.m_ReasonCannot = Convert.ToString(reader["ReasonCannot"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlTransaction myTransaction, string ConfirmTimeKeeperID)
        {
            string str = "";
            string[] myParams = new string[] { "@ConfirmTimeKeeperID" };
            object[] myValues = new object[] { ConfirmTimeKeeperID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "HRM_PROCESS_CONFIRMTIMEKEEPER_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_ConfirmTimeKeeperID = reader.GetGuid(reader.GetOrdinal("ConfirmTimeKeeperID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_WriteDate = Convert.ToDateTime(reader["WriteDate"]);
                    this.m_Date = Convert.ToDateTime(reader["Date"]);
                    this.m_TimeIn = Convert.ToDateTime(reader["TimeIn"]);
                    this.m_TimeOut = Convert.ToDateTime(reader["TimeOut"]);
                    this.m_ShiftCode = Convert.ToString(reader["ShiftCode"]);
                    this.m_Reason = Convert.ToString(reader["Reason"]);
                    this.m_Status = Convert.ToInt32(reader["Status"]);
                    this.m_ReasonCannot = Convert.ToString(reader["ReasonCannot"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public DataTable GetAllList()
        {
            int level = MyLogin.Level;
            string code = MyLogin.Code;
            string[] myParams = new string[] { "@Level", "@Code" };
            object[] myValues = new object[] { level, code };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_PROCESS_CONFIRMTIMEKEEPER_GetAllList", myParams, myValues);
        }

        public DataTable GetAllListByDays(DateTime BeginDate, DateTime EndDate)
        {
            int level = MyLogin.Level;
            string code = MyLogin.Code;
            string[] myParams = new string[] { "@Level", "@Code", "@BeginDate", "@EndDate" };
            object[] myValues = new object[] { level, code, BeginDate, EndDate };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_PROCESS_CONFIRMTIMEKEEPER_GetAllListByDays", myParams, myValues);
        }

        public DataTable GetList()
        {
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_PROCESS_CONFIRMTIMEKEEPER_GetList");
        }

        public DataTable GetListByDays(string EmployeeCode, DateTime BeginDate, DateTime EndDate)
        {
            string[] myParams = new string[] { "@EmployeeCode", "@BeginDate", "@EndDate" };
            object[] myValues = new object[] { EmployeeCode, BeginDate, EndDate };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_PROCESS_CONFIRMTIMEKEEPER_GetListByDays", myParams, myValues);
        }

        public DataTable GetListByEmployee(string EmployeeCode)
        {
            string[] myParams = new string[] { "@EmployeeCode" };
            object[] myValues = new object[] { EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_PROCESS_CONFIRMTIMEKEEPER_GetListByEmployee", myParams, myValues);
        }

        public string Insert()
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { this.m_ConfirmTimeKeeperID, this.m_EmployeeCode, this.m_WriteDate, this.m_Date, this.m_TimeIn, this.m_TimeOut, this.m_ShiftCode, this.m_Reason, this.m_Status, this.m_ReasonCannot, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_CONFIRMTIMEKEEPER_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { this.m_ConfirmTimeKeeperID, this.m_EmployeeCode, this.m_WriteDate, this.m_Date, this.m_TimeIn, this.m_TimeOut, this.m_ShiftCode, this.m_Reason, this.m_Status, this.m_ReasonCannot, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_PROCESS_CONFIRMTIMEKEEPER_Insert", myParams, myValues);
        }

        public string Insert(Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { ConfirmTimeKeeperID, EmployeeCode, WriteDate, Date, TimeIn, TimeOut, ShiftCode, Reason, Status, ReasonCannot, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_CONFIRMTIMEKEEPER_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { ConfirmTimeKeeperID, EmployeeCode, WriteDate, Date, TimeIn, TimeOut, ShiftCode, Reason, Status, ReasonCannot, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_PROCESS_CONFIRMTIMEKEEPER_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { ConfirmTimeKeeperID, EmployeeCode, WriteDate, Date, TimeIn, TimeOut, ShiftCode, Reason, Status, ReasonCannot, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_PROCESS_CONFIRMTIMEKEEPER_Insert", myParams, myValues);
        }

        public string NewID()
        {
            return SqlHelper.GenCode("HRM_PROCESS_CONFIRMTIMEKEEPER", "ConfirmTimeKeeperID", "TD");
        }

        public void SetData(Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            this.m_ConfirmTimeKeeperID = ConfirmTimeKeeperID;
            this.m_EmployeeCode = EmployeeCode;
            this.m_WriteDate = WriteDate;
            this.m_Date = Date;
            this.m_TimeIn = TimeIn;
            this.m_TimeOut = TimeOut;
            this.m_ShiftCode = ShiftCode;
            this.m_Reason = Reason;
            this.m_Status = Status;
            this.m_ReasonCannot = ReasonCannot;
            this.m_Description = Description;
        }

        public string Update()
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { this.m_ConfirmTimeKeeperID, this.m_EmployeeCode, this.m_WriteDate, this.m_Date, this.m_TimeIn, this.m_TimeOut, this.m_ShiftCode, this.m_Reason, this.m_Status, this.m_ReasonCannot, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_CONFIRMTIMEKEEPER_Update", myParams, myValues);
        }

        public string Update(Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { ConfirmTimeKeeperID, EmployeeCode, WriteDate, Date, TimeIn, TimeOut, ShiftCode, Reason, Status, ReasonCannot, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_CONFIRMTIMEKEEPER_Update", myParams, myValues);
        }

        public string Update(SqlConnection myConnection, Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { ConfirmTimeKeeperID, EmployeeCode, WriteDate, Date, TimeIn, TimeOut, ShiftCode, Reason, Status, ReasonCannot, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_PROCESS_CONFIRMTIMEKEEPER_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction, Guid ConfirmTimeKeeperID, string EmployeeCode, DateTime WriteDate, DateTime Date, DateTime TimeIn, DateTime TimeOut, string ShiftCode, string Reason, int Status, string ReasonCannot, string Description)
        {
            string[] myParams = new string[] { "@ConfirmTimeKeeperID", "@EmployeeCode", "@WriteDate", "@Date", "@TimeIn", "@TimeOut", "@ShiftCode", "@Reason", "@Status", "@ReasonCannot", "@Description" };
            object[] myValues = new object[] { ConfirmTimeKeeperID, EmployeeCode, WriteDate, Date, TimeIn, TimeOut, ShiftCode, Reason, Status, ReasonCannot, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_PROCESS_CONFIRMTIMEKEEPER_Update", myParams, myValues);
        }

        [DisplayName("ConfirmTimeKeeperID"), Category("Primary Key")]
        public Guid ConfirmTimeKeeperID
        {
            get
            {
                return this.m_ConfirmTimeKeeperID;
            }
            set
            {
                this.m_ConfirmTimeKeeperID = value;
            }
        }

        [DisplayName("Date"), Category("Column")]
        public DateTime Date
        {
            get
            {
                return this.m_Date;
            }
            set
            {
                this.m_Date = value;
            }
        }

        [DisplayName("Description"), Category("Column")]
        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
            }
        }

        [Category("Column"), DisplayName("EmployeeCode")]
        public string EmployeeCode
        {
            get
            {
                return this.m_EmployeeCode;
            }
            set
            {
                this.m_EmployeeCode = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_PROCESS_CONFIRMTIMEKEEPER";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        [Category("Column"), DisplayName("Reason")]
        public string Reason
        {
            get
            {
                return this.m_Reason;
            }
            set
            {
                this.m_Reason = value;
            }
        }

        [Category("Column"), DisplayName("ReasonCannot")]
        public string ReasonCannot
        {
            get
            {
                return this.m_ReasonCannot;
            }
            set
            {
                this.m_ReasonCannot = value;
            }
        }

        [Category("Column"), DisplayName("ShiftCode")]
        public string ShiftCode
        {
            get
            {
                return this.m_ShiftCode;
            }
            set
            {
                this.m_ShiftCode = value;
            }
        }

        [DisplayName("Status"), Category("Column")]
        public int Status
        {
            get
            {
                return this.m_Status;
            }
            set
            {
                this.m_Status = value;
            }
        }

        [Category("Column"), DisplayName("TimeIn")]
        public DateTime TimeIn
        {
            get
            {
                return this.m_TimeIn;
            }
            set
            {
                this.m_TimeIn = value;
            }
        }

        [DisplayName("TimeOut"), Category("Column")]
        public DateTime TimeOut
        {
            get
            {
                return this.m_TimeOut;
            }
            set
            {
                this.m_TimeOut = value;
            }
        }

        [DisplayName("WriteDate"), Category("Column")]
        public DateTime WriteDate
        {
            get
            {
                return this.m_WriteDate;
            }
            set
            {
                this.m_WriteDate = value;
            }
        }
    }
}

